import request from '@/utils/request'
import { encrypt } from '@/utils/my-encrypt'

export function login(data) {
  data.password = encrypt(data.password)
  return request({
    url: '/sys/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/sys/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout(token) {
  return request({
    url: '/sys/user/logout',
    method: 'post',
    data: { token }
  })
}

export function update(data) {
  data.password = encrypt(data.password)
  return request({
    url: '/sys/user/update',
    method: 'post',
    data
  })
}

export function register(data) {
  data.password = encrypt(data.password)
  return request({
    url: '/sys/user/register',
    method: 'post',
    data
  })
}

